== |
Compares 2 values and checks if both the values are equal or not if the values are equal then it returns True. |
(a==b) is False |
!= |
Compares 2 values and checks if both the values are equal or not if the values are not equal then it returns True. |
(a!=b) = True |
> |
Compares 2 values and checks if the left value is greater than the right value or not. |
(b>a) = True |
< |
Compares 2 values and checks if the left value is less than the right value or not. |
(a<b) = True |
>= |
Compares 2 values and checks if the left value is greater or equals to the right value or not. |
(b>=a) = True |
<= |
Compares 2 values and checks if the left value is less or equals to the right value or not. |
(a<=b) = True |
3.3 Operators in C#
What are Operators?
An operator is basically used to perform certain functions/calculations within the program. Example: Assigning some value to a varible with '=' operator.
Types Of Operators
Arithmetic Operator
This type of operator is used do arithmetics within the program.
int a = 2; int b = 8;
Relational Operator
This type of operator is used to do comparison within the program.
int a = 2; int b = 4;
Logical Operator
This type of operator is used to do comparison within the program.
int a = 2; int b = 4;
Relational Operator
This type of operator is used to do comparison within the program.
int a = 2; int b = 4;
Bitwise Operators
Bitwise operator works on bits and perform bit by bit operation.
Operator Precedence
This defines the importance of operators being used just like BODMAS rule in mathematics. The operator with higher precedence is done at first.